package com.test.springboot.thymeleaf.controller;

import com.test.springboot.thymeleaf.pojo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class RouterController {

    @GetMapping("/index")
    public String index(){
        return "index";
    }

    @GetMapping("/constant")
    public String constant(Model model){
        model.addAttribute("demo","测试");

        return "constant";
    }

    @GetMapping("/object")
    public String object(Model model){
        Student student = new Student();

        student.setUsername("cao jun");
        student.setPassword("*****************");

        model.addAttribute("student",student);

        return "object";
    }
}
